<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./OL_SDK/include-openlayers-local.js"></script>
    <script src="./libs/gaode.js"></script>
    <script src="./utils/createDraw.js"></script>
</head>

<body>
    <div id="map">
    </div>
    <script>
        // var map = new ol.Map({
        //     target: "map",
        //     layers: [gaode],
        //     view: new ol.View({
        //         projection: 'EPSG:4326',
        //         center: [114.30, 30.50],
        //         zoom: 4
        //     })
        // })
        /* 创建画布 */
        let source = new ol.source.Vector({

        })
        let layer = new ol.layer.Vector({
            source
        })
        // console.log(layer.getSource());
        var map = new ol.Map({
            target: "map",
            layers: [gaode],
            view: new ol.View({
                projection: 'EPSG:4326',
                center: [114.30, 30.50],
                zoom: 4
            })
        })
        map.addLayer(layer);
        /*
           type: Point,LineString,Circle,Polygon
           Square正方形(Circle的一种) Box矩形(LineString的一种)
         */
        let draw = createDraw({
            // type: "Point",
            // type: "LineString",
            // type: "Circle",
            // type: "Square",
            // type: "Box",
            type: "Polygon",
            source
        })
        map.addInteraction(draw)
    </script>
</body>

</html>